package com.jar.exercise.设计模式.工厂.工厂方法;

import com.jar.exercise.设计模式.工厂.工厂方法.factory.CocoColaFactory;
import com.jar.exercise.设计模式.工厂.工厂方法.factory.ColaFactory;
import com.jar.exercise.设计模式.工厂.工厂方法.factory.PepsiColaFactory;
import com.jar.exercise.设计模式.工厂.工厂方法.pojo.CocoCola;
import com.jar.exercise.设计模式.工厂.工厂方法.pojo.Cola;
import com.jar.exercise.设计模式.工厂.工厂方法.pojo.PepsiCola;

/**
 * 工厂方法和简单工厂的区别：
 * 工厂方法根据业务具体出不同的工厂，粒度更细一点
 */
public class Client {
    public static void main(String[] args) {
        ColaFactory cocoColaFactory = new CocoColaFactory();
        ColaFactory pepsiColaFactory = new PepsiColaFactory();
        Cola cocoCola = cocoColaFactory.createCola(CocoCola.class);
        Cola pepsiCola = pepsiColaFactory.createCola(PepsiCola.class);
        cocoCola.drink();
        pepsiCola.drink();
    }
}